fix: encode username in constructed gravatar URL#2488
Conversation
The username is inserted directly into `/api/gravatar/${props.username}`. A crafted username containing path separators or reserved URL characters can change the effective request path and potentially hit unintended endpoints.
Signed-off-by: tomaioo <203048277+tomaioo@users.noreply.github.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
2 Skipped Deployments
|
📝 WalkthroughWalkthroughThe Avatar component updates the Gravatar lookup request to URL-encode Changes
🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Hello! Thank you for opening your first PR to npmx, @tomaioo! 🚀 Here’s what will happen next:
|
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
|
Thanks for your first contribution, @tomaioo! 💪 We'd love to welcome you to the npmx community. Come and say hi on Discord! And once you've joined, visit npmx.wamellow.com to claim the contributor role. |
Summary
Security: Unencoded username in API route construction
Problem
Severity:
Medium| File:app/components/User/Avatar.vue:L30The username is inserted directly into
/api/gravatar/${props.username}. A crafted username containing path separators or reserved URL characters can change the effective request path and potentially hit unintended endpoints.Solution
Wrap the username with
encodeURIComponent(props.username)when constructing the URL path.Changes
app/components/User/Avatar.vue(modified)